<include file="Public/header" /> 

<!--主窗体-->
<div class="container app">
	<!--左侧菜单-->
	<include file="Public/sidebar" /> 
	<!--左侧菜单//-->	
	
	<!-- mainCon -->
	<div id="mainCon" class="mainCon">
		<h4>会员列表</h4>
		<div>
			<form class="form-inline" >
				<div class="form-group form-group-sm">
					<label for="mobile">手机号码：</label>
					<input type="text" class="form-control" id="mobile" name="mobile" placeholder="手机号码" value="<{$mobile}>">
				</div>
				<div class="form-group form-group-sm">
					<label for="member_name">昵称：</label>
					<input type="text" class="form-control" id="member_name" name="member_name" placeholder="会员昵称" value="<{$member_name}>" >
				</div>
				<div class="form-group form-group-sm">
					<label for="weixin">微信号：</label>
					<input type="text" class="form-control" id="weixin" name="weixin" placeholder="微信号" value="<{$weixin}>" >
				</div>
				<div class="form-group form-group-sm">
					<label for="member_status">状态：</label>
					<select id="member_status" name="member_status" class="form-control">
						<option value="-1">全部</option>
						<option value="0" <?php if (0 == $member_status) { echo 'selected="selected"'; } ?> >正常</option>
						<option value="1" <?php if (1 == $member_status) { echo 'selected="selected"'; } ?> >锁定</option>
					</select>
				</div>
				<div class="bk10"></div>
				<div class="form-group form-group-sm">
					<label for="">注册时间：</label>
					
					<input type="text" class="form-control laydate-icon" id="start_time" name="start_time"  value="<{$start_time?($start_time|date='Y-m-d H:i:s',###):''}>" >
					<span>-</span>
					<input type="text" class="form-control laydate-icon" id="end_time" name="end_time"  value="<{$end_time?($end_time|date='Y-m-d H:i:s',###):''}>" >
				</div>
				<div class="form-group form-group-sm">
					<label for="member_super_agent">总代理：</label>
					<select id="member_super_agent" name="member_super_agent" class="form-control">
						<option value="-1">全部</option>
						<option value="0" <?php if (0 == $member_super_agent) { echo 'selected="selected"'; } ?> >否</option>
						<option value="1" <?php if (1 == $member_super_agent) { echo 'selected="selected"'; } ?> >是</option>
					</select>
				</div>
				<div class="form-group form-group-sm">
					<label for="member_level">等级：</label>
					<select id="member_level" name="member_level" class="form-control">
						<option value="-1">全部</option>
						<foreach name="level_list" key="key" item="value" >
							<option value="<{$key}>" <?php if ($key == $member_level) { echo 'selected="selected"'; } ?> ><{$value}></option>
						</foreach>
					</select>
				</div>
				<div class="bk10"></div>
				<div class="form-group form-group-sm">
					<label for="member_name">推荐人昵称：</label>
					<input type="text" class="form-control" id="parent_name" name="parent_name" placeholder="推荐人昵称" value="<{$parent_name}>" >
				</div>
				<div class="form-group form-group-sm">
					<label for="member_name">推荐人编号：</label>
					<input type="text" class="form-control" id="parent_id" name="parent_id" placeholder="推荐人编号" value="<{$parent_id}>" style="width:100px">
				</div>
				<input type="hidden" name="p" value="0">
				<button type="submit" class="btn btn-default btn-sm">查询会员</button>
			</form>
		</div>
		<div class="bk10"></div>
		<table class="table table-bordered table-hover">
			<tr>
				<th>编号</th>
				<th>手机号码</th>
				<th>推荐人编号</th>
				<th>推荐人昵称</th>
				<th>昵称</th>
				<th>微信号</th>
				<th>注册时间</th>
				<th>会员等级</th>
				<th>总代理</th>
				<th>状态</th>
				<th>操作</th>
			</tr>
			
			<empty name="member_list">
				<tr><td colspan="9" style="text-align:center;color:#999">～暂无数据～</td></tr>
			<else /> 
			
				<foreach name="member_list" item="vo">
					<tr>
						<td><{$vo['id']}></td>
						<td><{$vo['mobile']}></td>
						<td><{$vo['recommend_id']}></td>
						<td><{$vo['fans_name']}></td>
						<td><{$vo['username']}></td>
						<td><{$vo['weixin']}></td>
						<td><{$vo['createtime']|date="Y-m-d H:i:s",###}></td>
						<td <if condition="$vo['level'] eq 1">style="color:#D00534;"</if> >
							<{$level_list[$vo['level']]}>
						</td>
						<td>
						<if condition="$vo['super_agent'] eq 1">
							<font color="#FFA530">是</font>
						<else />
							否
						</if>
						</td>
						<td>
							<if condition="$vo['status'] eq 1">
								<span style="color:#FF3930">锁定</span>
							<else />
								<span style="color:#66CC33">正常</span>
							</if>
						</td>
						<td>
							<a href="<{:U('Admin/User/downMember',array('uid'=>$vo['id'],'k'=>2,'sk'=>0))}>">推广</a>
							&nbsp;&nbsp;
							<if condition="$vo['status'] eq 1">
								<a href="javascript:void(0)" class="userLock" data-status="0" data-id="<{$vo['id']}>">解锁</a>
							<else />
								<a href="javascript:void(0)" class="userLock" data-status="1" data-id="<{$vo['id']}>">锁定</a>
							</if>
							&nbsp;&nbsp;
							<a href="<{:U('Admin/User/memberInfo',array('uid'=>$vo['id'],'k'=>2,'sk'=>0))}>">编辑</a>
							&nbsp;&nbsp;
							<a href="<{:U('Admin/User/commission',array('uid'=>$vo['id'],'k'=>2,'sk'=>0))}>">佣金</a>
						</td>
					</tr>
				</foreach>
			
			</empty> 
			
			
		</table>
		
		<div class="pagebar">
			<{$pager}>
		</div>
		
	</div>
	<!-- mainCon// -->
	
</div>
<!--主窗体//-->

<script src="__PUBLIC__/js/layer/layer.js"></script>
<script>

$(function(){

	var start = {
		elem: '#start_time',
		format: 'YYYY/MM/DD hh:mm:ss',
		istime: true,
		istoday: false,
		choose: function(datas){
			 end.min = datas; //开始日选好后，重置结束日的最小日期
			 end.start = datas //将结束日的初始值设定为开始日
		}
	};
	var end = {
		elem: '#end_time',
		format: 'YYYY/MM/DD hh:mm:ss',
		istime: true,
		istoday: false,
		choose: function(datas){
			start.max = datas; //结束日选好后，重置开始日的最大日期
		}
	};
	laydate(start);
	laydate(end);

	$(".userLock").click(function(){
		var status = $(this).attr("data-status");
		var uid = $(this).attr("data-id");
		if(status == 0){
			var msg = '您是否确定 <font color="green">[解锁]</font> 该会员？解锁后该会员恢复正常使用。';
		}else{
			var msg = '您是否确定 <font color="red">[锁定]</font> 该会员？锁定后该会员将无法登录！';
		}
		layer.confirm(msg, {icon: 3, title:'提示'}, function(index){
			$.post("<{:U('Admin/User/memberLock')}>",{"status":status,"uid":uid},function(r){
				if(r.error == 1){
					layer.close(index);
					layer.alert(r.errmsg,{icon: 2});
				}else{
					window.location.reload();
				}
			});
		});
		return false;
	});
});
</script>

<include file="Public/footer" /> 